'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 英雄技能子项
 * @author sundbcn@gmail.com (sun debing)
 */

var mongoose = require('mongoose');

///////////////////////////////////////////////////////////
/**
 * 英雄技能项
 * @type {mongoose}
 */
var skillItemSchema = new mongoose.Schema({
    skill_type: {
        type: Number,
        required: true,
        index: true
    },

    lv: {
        type: Number,
        default: 1
    }
});

/**
 * 技能等级
 * @return {[type]} [description]
 */
skillItemSchema.methods.getLv = function () {
    return this.lv;
};

/**
 * 升级技能
 * @return {[type]} [description]
 */
skillItemSchema.methods.upgrade = function () {
    this.lv++;
};

if (!skillItemSchema.options.toJSON) {
    skillItemSchema.options.toJSON = {};
}
/* jshint unused:false */
skillItemSchema.options.toJSON.transform = function (doc, ret) {
    delete ret._id;
};

module.exports = skillItemSchema;
